//
//  UIGestureRecognizer+zll.m
//  test
//
//  Created by Vincent on 2017/3/31.
//  Copyright © 2017年 Vincent. All rights reserved.
//

#import "UIGestureRecognizer+zll.h"
#import <objc/runtime.h>



@interface UIGestureRecognizer ()

@property(nonatomic,copy)gestureAction zll_action;

@end



@implementation UIGestureRecognizer (zll)


-(gestureAction)zll_action{
    
    return objc_getAssociatedObject(self, "zll_action");
}

-(void)setZll_action:(gestureAction)zll_action{
    
    objc_setAssociatedObject(self, "zll_action", zll_action, OBJC_ASSOCIATION_COPY);
}


+(id)gestureRecognizerWithAction:(void (^)(UIGestureRecognizer *))action{
    
    UIGestureRecognizer *gsure = [[self.class alloc] initWithTarget:self action:@selector(gestureAction:)];
    gsure.zll_action = action;
    
    return gsure;
}

+(void)gestureAction:(UIGestureRecognizer *)gsure{
    if(gsure.zll_action){
        gsure.zll_action(gsure);
    }
}

-(void)dealloc{
    
    
}


@end
